package com.mnc.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.mnc.dao.inte.IUserDao;
import com.mnc.entity.User;
import com.mnc.service.base.BaseServiceImpl;
import com.mnc.service.inte.IUserService;
import com.mnc.util.Helper;
import com.mnc.util.MD532;

@Service
public class UserServiceImpl extends BaseServiceImpl implements IUserService{
		
	private IUserDao userDao;
	
	public IUserDao getUserDao() {
		return userDao;
	}
	@Resource
	public void setUserDao(IUserDao userDao) {
		this.userDao = userDao;
	}

	public User userLogin(String loginName,String loginPass) {
		List<User> data = this.getUserDao().getData(User.class, Helper.WHERE_USER_LOGIN, new Object[] {loginName});
		if (null!=data&&data.size()>0&&new MD532().getMD5(loginPass).equals(data.get(0).getUserLoginPass())) {
			return data.get(0);
		}
		return null;
		
	}
}
